<?php
namespace app\lib;

class Code
{
    // 系统级错误
    const SUCCESS = 0;

    const SYSTEM = 10000;

    const PARAM = 10001;

    const AUTH = 10002;

    const CODE_ERROR = 10003;

    const SYSTEM_EXCEPTION = 10004;

    const SYS_USER_NOT_FIND = 20001;

    const SYS_USER_PASSWD_FAIL = 20002;
    const SYS_USER_CLOSE = 20003;
    const SYS_USER_ISEXIST= 20004;
    public static $arrMsg = [
        
        self::SUCCESS => 'ok',
        self::SYSTEM => '系统错误',
        self::PARAM => '参数错误',
        self::AUTH => '权限错误',
        self::CODE_ERROR => '服务异常',
        self::SYSTEM_EXCEPTION => "系统异常，请稍后重试",
        self::SYS_USER_NOT_FIND => "账户不存在",
        self::SYS_USER_PASSWD_FAIL => "密码错误",
        self::SYS_USER_CLOSE => '用户被禁用',
        self::SYS_USER_ISEXIST=> '用户名已存在',
    ];

    public static function getMsg($code)
    {
        return self::$arrMsg[$code] ?? self::$arrMsg[self::SYSTEM_EXCEPTION];
    }
}
